package com.loongtech.bi.entity.system;

import com.loongtech.core.gen.GenInnerK;
import com.loongtech.core.jpa.entity.EntityIntAutoWithoutVersion;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;

//用户工程角色表，因为历史原因，名字没改

@Entity
@Table(name = "system_user_role", indexes = {@Index(name = "system_user_role_project_index_unique", unique = true, columnList = "userId,roleId,projectId")})
@GenInnerK
public class EntitySysUserRole extends EntityIntAutoWithoutVersion {
	private static final long serialVersionUID = 1L;
    @Column(columnDefinition="int(11) NOT NULL default 0")
    private Integer userId;                    // 系统用户id
    @Column(columnDefinition="int(11) NOT NULL default 0")
    private Integer roleId;                    // 角色id
    @Column(columnDefinition="int(11) NOT NULL default 0")
    private Integer projectId;              //工程id

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getRoleId() {
        return roleId;
    }

    public void setRoleId(Integer roleId) {
        this.roleId = roleId;
    }

    public Integer getProjectId() {
        return projectId;
    }

    public void setProjectId(Integer projectId) {
        this.projectId = projectId;
    }

    @Override
    public String toString() {
        return "EntitySysUserProjectRole{" +
                "id=" + id +
                ", userId=" + userId +
                ", roleId=" + roleId +
                ", projectId=" + projectId +
                '}';
    }

    public static class K {
        public static final String userId = "userId";
        public static final String roleId = "roleId";
        public static final String id = "id";
        public static final String version = "version";

        //userId, roleId, id, version,
        public static java.util.List<String> toList() {
            java.util.List<String> list = new java.util.ArrayList<>();
            list.add(userId);
            list.add(roleId);
            list.add(id);
            list.add(version);
            return list;
        }
    }
}